\(\int \sin (x) \sqrt {1+\sin ^2(x)} \, dx\) [114]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 13, antiderivative size = 30 \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=-\arcsin \left (\frac {\cos (x)}{\sqrt {2}}\right )-\frac {1}{2} \cos (x) \sqrt {2-\cos ^2(x)} \]

[Out]

-arcsin(1/2*cos(x)*2^(1/2))-1/2*cos(x)*(2-cos(x)^2)^(1/2)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3265, 201, 222} \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=-\arcsin \left (\frac {\cos (x)}{\sqrt {2}}\right )-\frac {1}{2} \cos (x) \sqrt {2-\cos ^2(x)} \]

[In]

Int[Sin[x]*Sqrt[1 + Sin[x]^2],x]

[Out]

-ArcSin[Cos[x]/Sqrt[2]] - (Cos[x]*Sqrt[2 - Cos[x]^2])/2

Rule 201

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[x*((a + b*x^n)^p/(n*p + 1)), x] + Dist[a*n*(p/(n*p + 1)),
 Int[(a + b*x^n)^(p - 1), x], x] /; FreeQ[{a, b}, x] && IGtQ[n, 0] && GtQ[p, 0] && (IntegerQ[2*p] || (EqQ[n, 2
] && IntegerQ[4*p]) || (EqQ[n, 2] && IntegerQ[3*p]) || LtQ[Denominator[p + 1/n], Denominator[p]])

Rule 222

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSin[Rt[-b, 2]*(x/Sqrt[a])]/Rt[-b, 2], x] /; FreeQ[{a, b}
, x] && GtQ[a, 0] && NegQ[b]

Rule 3265

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Cos[e + f*x], x]}, Dist[-ff/f, Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos
[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \sqrt {2-x^2} \, dx,x,\cos (x)\right ) \\ & = -\frac {1}{2} \cos (x) \sqrt {2-\cos ^2(x)}-\text {Subst}\left (\int \frac {1}{\sqrt {2-x^2}} \, dx,x,\cos (x)\right ) \\ & = -\arcsin \left (\frac {\cos (x)}{\sqrt {2}}\right )-\frac {1}{2} \cos (x) \sqrt {2-\cos ^2(x)} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.04 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.77 \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=-\frac {\cos (x) \sqrt {3-\cos (2 x)}}{2 \sqrt {2}}+i \log \left (i \sqrt {2} \cos (x)+\sqrt {3-\cos (2 x)}\right ) \]

[In]

Integrate[Sin[x]*Sqrt[1 + Sin[x]^2],x]

[Out]

-1/2*(Cos[x]*Sqrt[3 - Cos[2*x]])/Sqrt[2] + I*Log[I*Sqrt[2]*Cos[x] + Sqrt[3 - Cos[2*x]]]

Maple [A] (verified)

Time = 0.77 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.70

method result size
default \(-\frac {\sqrt {\left (1+\sin ^{2}\left (x \right )\right ) \left (\cos ^{2}\left (x \right )\right )}\, \left (\arcsin \left (\cos ^{2}\left (x \right )-1\right )+\sqrt {-\left (\cos ^{4}\left (x \right )\right )+2 \left (\cos ^{2}\left (x \right )\right )}\right )}{2 \cos \left (x \right ) \sqrt {1+\sin ^{2}\left (x \right )}}\) \(51\)

[In]

int(sin(x)*(1+sin(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-1/2*((1+sin(x)^2)*cos(x)^2)^(1/2)*(arcsin(cos(x)^2-1)+(-cos(x)^4+2*cos(x)^2)^(1/2))/cos(x)/(1+sin(x)^2)^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 71 vs. \(2 (25) = 50\).

Time = 0.29 (sec) , antiderivative size = 71, normalized size of antiderivative = 2.37 \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=-\frac {1}{2} \, \sqrt {-\cos \left (x\right )^{2} + 2} \cos \left (x\right ) + \frac {1}{2} \, \arctan \left (-\frac {\cos \left (x\right ) \sin \left (x\right ) - {\left (\cos \left (x\right )^{3} - \cos \left (x\right )\right )} \sqrt {-\cos \left (x\right )^{2} + 2}}{\cos \left (x\right )^{4} - 3 \, \cos \left (x\right )^{2} + 1}\right ) - \frac {1}{2} \, \arctan \left (\frac {\sin \left (x\right )}{\cos \left (x\right )}\right ) \]

[In]

integrate(sin(x)*(1+sin(x)^2)^(1/2),x, algorithm="fricas")

[Out]

-1/2*sqrt(-cos(x)^2 + 2)*cos(x) + 1/2*arctan(-(cos(x)*sin(x) - (cos(x)^3 - cos(x))*sqrt(-cos(x)^2 + 2))/(cos(x
)^4 - 3*cos(x)^2 + 1)) - 1/2*arctan(sin(x)/cos(x))

Sympy [F]

\[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=\int \sqrt {\sin ^{2}{\left (x \right )} + 1} \sin {\left (x \right )}\, dx \]

[In]

integrate(sin(x)*(1+sin(x)**2)**(1/2),x)

[Out]

Integral(sqrt(sin(x)**2 + 1)*sin(x), x)

Maxima [A] (verification not implemented)

none

Time = 0.37 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.83 \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=-\frac {1}{2} \, \sqrt {-\cos \left (x\right )^{2} + 2} \cos \left (x\right ) - \arcsin \left (\frac {1}{2} \, \sqrt {2} \cos \left (x\right )\right ) \]

[In]

integrate(sin(x)*(1+sin(x)^2)^(1/2),x, algorithm="maxima")

[Out]

-1/2*sqrt(-cos(x)^2 + 2)*cos(x) - arcsin(1/2*sqrt(2)*cos(x))

Giac [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 25, normalized size of antiderivative = 0.83 \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=-\frac {1}{2} \, \sqrt {-\cos \left (x\right )^{2} + 2} \cos \left (x\right ) - \arcsin \left (\frac {1}{2} \, \sqrt {2} \cos \left (x\right )\right ) \]

[In]

integrate(sin(x)*(1+sin(x)^2)^(1/2),x, algorithm="giac")

[Out]

-1/2*sqrt(-cos(x)^2 + 2)*cos(x) - arcsin(1/2*sqrt(2)*cos(x))

Mupad [F(-1)]

Timed out. \[ \int \sin (x) \sqrt {1+\sin ^2(x)} \, dx=\int \sin \left (x\right )\,\sqrt {{\sin \left (x\right )}^2+1} \,d x \]

[In]

int(sin(x)*(sin(x)^2 + 1)^(1/2),x)

[Out]

int(sin(x)*(sin(x)^2 + 1)^(1/2), x)